﻿<Window x:Class="PetriNetSharp.MainWindow"
		xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
		xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
		xmlns:customUI="clr-namespace:PetriNetSharp.CustomUIControls"
		Title="PetriNetSharp" 
		Height="600" 
		Width="600" 
		Background="Ivory" 
		Icon="/PetriNetSharp;component/Images/PetriNetSharp.ico"
		PreviewKeyUp="Window_PreviewKeyUp">
	<Grid>
		<Grid.ColumnDefinitions>
			<ColumnDefinition Width="Auto" />
			<ColumnDefinition Width="*" />
		</Grid.ColumnDefinitions>
		<Grid.RowDefinitions>
			<RowDefinition Height="Auto" />
			<RowDefinition Height="*" />
		</Grid.RowDefinitions>
		
		
		<Menu Grid.Row="0" BorderThickness="0,0,0,2" BorderBrush="DarkOliveGreen"
				 Grid.Column="0"
				 Grid.ColumnSpan="2">
			<MenuItem Header="_File">
				<MenuItem x:Name="saveMenuItem" 
						  Header="_Save"
						  Click="saveMenuItem_Click" />
				<MenuItem x:Name="saveAsMenuItem" 
						  Header="Save _As"
						  Click="saveAsMenuItem_Click" />
				<MenuItem x:Name="loadMenuItem" 
						  Header="_Load"
						  Click="loadMenuItem_Click" />
				<Separator />
				<MenuItem x:Name="exportMenuItem"
						  Header="_Export as Image"
						  Click="exportMenuItem_Click" />
				<Separator />
				<MenuItem x:Name="printMenuItem"
						  Header="_Print"
						  Click="printMenuItem_Click" />
				<Separator />
				<MenuItem x:Name="exitMenuItem"  
						  Header="_Exit"
						  Click="exitMenuItem_Click" />
			</MenuItem>
		</Menu>
		
		<Border Grid.Column="0" 
				Grid.Row="1"
				BorderThickness="0,0,5,0"
				BorderBrush="DarkOliveGreen">
			
			<!-- Side Button Stack Panel -->
			<StackPanel x:Name="buttonPanelStackPanel" 
						Orientation="Horizontal">
				
				<!-- Modify Dock Panel -->
				<DockPanel x:Name="modifyDockPanel" 
						   Background="DarkKhaki"
						   Width="0" >
					
					<!-- Mode Stack Panel -->
					<StackPanel DockPanel.Dock="Bottom">
						<Button x:Name="runButton"
								Height="55"
								Click="runButton_Click" >
							<StackPanel>
								<Image Source="/PetriNetSharp;component/Images/run.png" 
									   Height="25" />
								<TextBlock HorizontalAlignment="Center" 
										   TextAlignment="Center">
									Run
								</TextBlock>
							</StackPanel>
							<Button.ToolTip>
								<customUI:SharpToolTip Header="Run Petri Net">
									<customUI:SharpToolTip.Text>
										Run the Petri Net with the values as you have set. See
										how the transitions and palces interact and fire.
									</customUI:SharpToolTip.Text>
									<customUI:SharpToolTip.ShortcutText>
										Shortcut: Ctrl + R
									</customUI:SharpToolTip.ShortcutText>
								</customUI:SharpToolTip>
							</Button.ToolTip>
						</Button>
					</StackPanel>
					
					<!-- Modify Stack Panel -->
					<StackPanel x:Name="modifyStackPanel"
								 DockPanel.Dock="Top">

						<!-- Cursor Radio Button -->
						<RadioButton x:Name="cursorRadioButton" 
									 Style="{StaticResource {x:Type ToggleButton}}"
									 IsChecked="True"
									 Height="50">
							<StackPanel>
								<Image Source="/PetriNetSharp;component/Images/cursor.png" 
									   Height="25" />
								<TextBlock HorizontalAlignment="Center"
										   TextAlignment="Center">
									Cursor
								</TextBlock>
							</StackPanel>
							<RadioButton.ToolTip>
								<customUI:SharpToolTip Header="Cursor">
									<customUI:SharpToolTip.Text>
										Nothing is added to the Petri Net when you click the graph,
										use this for interacting with items already on the graph.
									</customUI:SharpToolTip.Text>
									<customUI:SharpToolTip.ShortcutText>
										Shortcut: Ctrl + U
									</customUI:SharpToolTip.ShortcutText>
								</customUI:SharpToolTip>
							</RadioButton.ToolTip>

						</RadioButton>

						<!-- Place Radio Button -->
						<RadioButton x:Name="placeRadioButton" 
									 Style="{StaticResource {x:Type ToggleButton}}"
									 Height="50">
							<StackPanel>
								<Image Source="/PetriNetSharp;component/Images/place.png"
									   Height="25"/>
								<TextBlock HorizontalAlignment="Center"
										   TextAlignment="Center">
									Place
								</TextBlock>
							</StackPanel>

							<RadioButton.ToolTip>
								<customUI:SharpToolTip Header="Place">
									<customUI:SharpToolTip.Text>
										A Place is added to the Petri Net when you click on the graph to the 
										right, it is added at the point where you click.
									</customUI:SharpToolTip.Text>
									<customUI:SharpToolTip.ShortcutText>
										Shortcut: Ctrl + A
									</customUI:SharpToolTip.ShortcutText>
								</customUI:SharpToolTip>
							</RadioButton.ToolTip>

						</RadioButton>

						<!-- Transition Radio Button -->
						<RadioButton x:Name="transitionRadioButton" 
									 Style="{StaticResource {x:Type ToggleButton}}"
									 Height="50" >
							<StackPanel>
								<Image Source="/PetriNetSharp;component/Images/transition.png"
									   Height="25"/>
								<TextBlock HorizontalAlignment="Center"
										   TextAlignment="Center" >
									Transition
								</TextBlock>
							</StackPanel>

							<RadioButton.ToolTip>
								<customUI:SharpToolTip Header="Transition">
									<customUI:SharpToolTip.Text>
										A Transition is added to the Petri Net when you click on the graph to the 
										right, it is added at the point where you click.
									</customUI:SharpToolTip.Text>
									<customUI:SharpToolTip.ShortcutText>
										Shortcut: Ctrl + T
									</customUI:SharpToolTip.ShortcutText>
								</customUI:SharpToolTip>
							</RadioButton.ToolTip>

						</RadioButton>

						<!-- Arc Radio Button -->
						<RadioButton x:Name="arcRadioButton" 
									 Style="{StaticResource {x:Type ToggleButton}}"
									 Height="50">
							<StackPanel>
								<Image Source="/PetriNetSharp;component/Images/arc.png"
									   Height="25" />
								<TextBlock HorizontalAlignment="Center"
										   TextAlignment="Center">
									Arc
								</TextBlock>
							</StackPanel>

							<RadioButton.ToolTip>
								<customUI:SharpToolTip Header="Arc">
									<customUI:SharpToolTip.Text>
										Connect a Transition and a Place together with this. Click a Place or
										Transition and then click another Place or Transition to connect the two.
									</customUI:SharpToolTip.Text>
									<customUI:SharpToolTip.ShortcutText>
										Shortcut: Ctrl + C
									</customUI:SharpToolTip.ShortcutText>
								</customUI:SharpToolTip>
							</RadioButton.ToolTip>

						</RadioButton>

					</StackPanel>
					<!-- End of Creation Stack Panel -->
					
					
				</DockPanel>
				
				<!-- Running Dock Panel -->
				<DockPanel x:Name="runningDockPanel"
						   Background="DarkKhaki"
						   Width="0" >
					
					<!-- Mode Stack Panel -->
					<StackPanel DockPanel.Dock="Bottom">
						
						<!-- Modify Button-->
						<Button x:Name="modifyButton"
								Height="55"
								Click="modifyButton_Click" >
							<StackPanel>
								<Image Source="/PetriNetSharp;component/Images/edit.png"
									   Height="25" />
								<TextBlock>
									Modify
								</TextBlock>
							</StackPanel>
							<Button.ToolTip>
								<customUI:SharpToolTip Header="Modify PetriNet">
									<customUI:SharpToolTip.Text>
										Edit the places, arcs, and transitions in the Petri Net
									</customUI:SharpToolTip.Text>
									<customUI:SharpToolTip.ShortcutText>
										Shortcut: Ctrl + M
									</customUI:SharpToolTip.ShortcutText>
								</customUI:SharpToolTip>
							</Button.ToolTip>
						</Button>
					</StackPanel>
					
					<!-- Running Stack Panel -->
					<StackPanel x:Name="runningStackPanel" 
								DockPanel.Dock="Top">
						
						<!-- Manual Fire Radio Button -->
						<Button x:Name="manualFireRadioButton"
								Height="55"
								Click="manualFireRadioButton_Click">
							<StackPanel>
								<Image Source="/PetriNetSharp;component/Images/fire.png" 
									   Height="25" />
								<TextBlock HorizontalAlignment="Center"
										   TextAlignment="Center">
									Fire
								</TextBlock>
							</StackPanel>
							<Button.ToolTip>
								<customUI:SharpToolTip Header="Manual Fire">
									<customUI:SharpToolTip.Text>
										Fire the Petri Net manually
									</customUI:SharpToolTip.Text>
									<customUI:SharpToolTip.ShortcutText>
										Shortcut: Ctrl + F
									</customUI:SharpToolTip.ShortcutText>
								</customUI:SharpToolTip>
							</Button.ToolTip>
						</Button>
						
						<!-- Auto Check Box-->
						<CheckBox x:Name="autoFireCheckBox"
								  Height="55"
								  Style="{StaticResource {x:Type ToggleButton}}">
							<StackPanel>
								<Image Source="/PetriNetSharp;component/Images/fire.png" 
									   Height="25" />
								<ComboBox x:Name="autoFireSecondsComboBox" />
							</StackPanel>
							<ToggleButton.ToolTip>
								<customUI:SharpToolTip Header="Auto Fire">
									<customUI:SharpToolTip.Text>
										Have the Petri Net automatically fire, until auto fire is turned
										off or the Petri Net can no longer fire.
									</customUI:SharpToolTip.Text>
									<customUI:SharpToolTip.ShortcutText>
										Shortcut: Ctrl + A
									</customUI:SharpToolTip.ShortcutText>
								</customUI:SharpToolTip>
							</ToggleButton.ToolTip>
						</CheckBox>
						
						<Button x:Name="resetButton"
								Height="55"
								Click="resetButton_Click">
							<StackPanel>
								<Image Source="/PetriNetSharp;component/Images/reset.png" 
									   Height="25" />
								<TextBlock>
									Reset
								</TextBlock>
							</StackPanel>
							<Button.ToolTip>
								<customUI:SharpToolTip Header="Reset Petri Net">
									<customUI:SharpToolTip.Text>
										Reset the Petri Net so it is exactly as when it first started
										i.e. all tokens return to their original places
									</customUI:SharpToolTip.Text>
									<customUI:SharpToolTip.ShortcutText>
										Shortcut: Ctrl + R
									</customUI:SharpToolTip.ShortcutText>
								</customUI:SharpToolTip>
							</Button.ToolTip>
						</Button>
						
					</StackPanel>
				</DockPanel>
			</StackPanel>
		</Border>
		
		<!-- Grid Scroll Viewer -->
		<ScrollViewer Grid.Column="1" 
					  Grid.Row="1"
					  HorizontalScrollBarVisibility="Auto" 
					  VerticalScrollBarVisibility="Auto">
			<!-- Dock panel, this is here as a workaround for exporting as image-->
			<DockPanel>
				<!-- Grid Canvas -->
				<Canvas x:Name="graphCanvas" 
						Background="{DynamicResource ModifyGraphBackgroundBrush}"  
						Width="1200" 
						Height="900"
						MouseRightButtonDown="graphCanvas_MouseRightButtonDown"/>
			</DockPanel>
		</ScrollViewer>
	</Grid>
	
</Window>
